rust環境 on VSCode & Atom


概要

AutoComplete、Buildとか含めていろんなツールを見てみる的な。

Rustに関してはずっとVSCode使ってたんだけど、VSCodeよりAtomのほうが圧倒的にいい環境だった。



VSCode編

後述するAtom編のほうが、できることが多いしエラーも見やすいのでオススメ。


RustyCode

VSCode上でいろいろな機能を組み合わせるやつ。

racerなどに依存がある。


RustyCode

https://github.com/saviorisdead/RustyCode


基本的にはこいつのInstallationに付き合えばOK。



racer入れる

RustyCodeがAutoCompleteに使っている。

racer

https://github.com/phildawes/racer


cargo install racer

RustyCodeのセッティングファイルにパスを指定(後述)



Rustのコード

racerがGoToDefineとかでRustのコード自体も要求してくるので、入れる。

固定でさえあれば、適当な場所でいいんだと思う。

Rust

https://github.com/rust-lang/rust


rustfmt入れる

rustfmt

https://github.com/rust-lang-nursery/rustfmt


cargo install rustfmt


RustyCodeのセッティングファイルにパスを指定(後述)



RustyCodeのセッティングにいろいろインストールしたものを指定

フルパス指定しないとダメだった。

{

    "rust.racerPath": "/Users/tomggg/.cargo/bin/racer", // Specifies path to Racer binary if it's not in PATH

    "rust.rustLangSrcPath": "/Users/tomggg/.cargo/rust-master/src", // Specifies path to /src directory of local copy of Rust sources

    "rust.rustfmtPath": "/Users/tomggg/.cargo/bin/rustfmt", // Specifies path to Rustfmt binary if it's not in PATH

    "rust.cargoPath": "/usr/local/Cellar/rust/1.7.0/bin/cargo", // Specifies path to Cargo binary if it's not in PATH

    "rust.formatOnSave": false, // Turn on/off autoformatting file on save (EXPERIMENTAL)

    "rust.checkOnSave": false, // Turn on/off `cargo check` project on save (EXPERIMENTAL)

    "rust.checkWithClippy": false // Turn on/off `cargo clippy` project on save (EXPERIMENTAL) (cargo-clippy should be installed)

}



Atom編


ここみればOK

http://qiita.com/nacika_ins/items/044c87fd8bd1d7c41191

コマンドライン上からいろいろインポートするだけ + Atom上のセッティングに2行書いたら終わる。

racerとRustのコードも必要なんで、一応書く。


racer入れる

AtomでもAutoCompleteに使っている。

racer

https://github.com/phildawes/racer


cargo install racer

Atomのセッティングにパスを指定

/Users/SOMEONE/.cargo/bin



Rustのコード

同じく、racerがGoToDefineとかでRustのコード自体も要求してくるので、入れる。

固定でさえあれば、適当な場所でいいんだと思う。

Rust

https://github.com/rust-lang/rust



あとはAtomのセッティングいじって再起動する。